using System.Reflection;
using DeclarativeTest.Core;
using DeclarativeTest.Core.Attributes;
using DeclarativeTest.Core.Support;

namespace DeclarativeTest.Actions
{
	[Action( Namespaces.BASE_ACTIONS )]
	public class LoadActions : IAction
	{
		/// <summary>
		/// Used for <see cref="Assembly.Load(string)"/> to load assembly
		/// </summary>
		public string AssemblyName { get; set; }

		#region IAction Members

		/// <summary>
		/// Runs action.
		/// </summary>
		/// <param name="context">Execution context.</param>
		public void Run( RunContext context )
		{
			Assembly assembly = Assembly.Load( AssemblyName );
			ActionRegistry.RegisterFactory( new DefaultActionFactory( assembly ) );
		}

		#endregion
	}
}